package entity

import (
	"gitee.com/linxing_3/sr-core/plugins/storage/database"
	"gitee.com/linxing_3/sr-core/yerr"
)

func AutoMigrate(dataset database.IDataSet) error {
	db, ok := dataset.UnLoggerDefault()
	if !ok {
		return yerr.ErrBizPluginNotFound.Errorf("database not found")
	}

	return db.AutoMigrate(
		&SysConfig{},
		&SysDept{},
		&SysDictGroup{},
		&SysDictValue{},
		&SysMenu{},
		&SysPost{},
		&SysRegion{},
		&SysRole{},
		&SysUser{},
		&SysUserBind{},
		&SysUserTagMini{},
		&SysUserTag{},
		&SysUserThirdBind{},
		&SysApi{},
	)
}
